using System;
using System.Data;
using System.Configuration;
using System.Collections;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Web.UI.HtmlControls;

public partial class Lib_ImageProduct : System.Web.UI.Page
{
    protected void Page_Load(object sender, EventArgs e)
    {
        string ID = Request.QueryString["ID"].ToString();

        string connect = ConfigurationManager.ConnectionStrings["CRMCUAHANGBANHConnectionString"].ConnectionString;
        BSC_Class.BSCConnection cnn = new BSC_Class.BSCConnection(connect);

        DataTable dtProducts = cnn.SelectRows("select * from V_HOSOSANPHAM where MaSanPham=N'"+ID+"'");
        DataRow product = dtProducts.NewRow();       

        if (!Convert.IsDBNull(product["Hinh"]))
        {
            Response.Redirect("~/Images/no_image.jpg");        
        }
        else
        {
            Response.ContentType = "image/jpeg";
            Response.Redirect("~/Images/banhkem1.jpg");           
            //Response.BinaryWrite(product["Hinh"].ToString());
           
        }        
    }
}
